<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>后台管理系统</title>
    <jsp:include page="/WEB-INF/view/common/base.jsp"/>
    <link rel="stylesheet" href="/resource/web/js/facebook/css/reset.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="/resource/web/js/facebook/css/style.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="/resource/web/js/facebook/css/invalid.css" type="text/css" media="screen" />
    <script type="text/javascript" src="/resource/web/js/facebook/scripts/simpla.jquery.configuration.js"></script>
    <script type="text/javascript" src="/resource/web/js/facebook/scripts/facebox.js"></script>
</head>
<body id="login" onkeydown="login(event)">
<div id="login-wrapper" class="png_bg">
    <div id="login-top">
        <h1>后台管理系统</h1>
        <a href="http://www.865171.cn"><img id="logo" src="/resource/web/js/facebook/images/logo.png" alt="Simpla Admin logo" /></a> </div>
    <div id="login-content">
        <form id="loginForm" action="/back/sysuser/loginBack" type="get">
            <div class="notification attention png_bg" style="display: none;width: 200px;">
                <a href="#" class="close">
                <img src="/resource/web/js/facebook/images/icons/cross_grey_small.png"alt="close" /></a>
                <div></div>
            </div>
            <p>
                <label>用户名</label>
                <input class="text-input" name="auth_code" type="hidden" />
                <input class="text-input" name="name" type="text" />
            </p>
            <div class="clear"></div>
            <p>
                <label>密码</label>
                <input class="text-input" name="password" type="password" />
            </p>
            <div class="clear"></div>
            <p id="remember-password">
                <label style="margin-right: 0px">记住我</label><input type="checkbox" />
            </p>
            <div class="clear"></div>
            <p>
                <input class="button" id="loginBtn" type="button" value="登录" />
            </p>
        </form>
    </div>
</div>
<script type="text/javascript">
    function login(event){
        var event=window.event?window.event:event; if(event.keyCode==13){
            $("#loginBtn").trigger("click");
        }
    }
    $(function(){
        $("#loginBtn").click(function(){
            var name = $("input[name='name']").val();
            var password = $("input[name='password']").val();
            $.ajax({
                url:"/back/sysuser/checkUser",
                type:"get",
                data:{userName:name,password:password},
                success:function(data){
                    if(data && data.authCode){
                        // 设置authCode
                        $("input[name='auth_code']").val(data.authCode);
                        $("#loginForm").submit();
                    }else{
                        // 设置错误信息
                        $(".notification").find("div").html(data.reason).end().fadeIn(2000,function(){
                            $(this).fadeOut(4000,null);
                        });
                    }
                }
            })
        })

        $.ajax({
            url:"/sysparam/getSysParamByKey",
            data:"param_key=IMG_SETTING",
            success:function(data){
                alert(data);
            }
        })
    })
</script>
</body>
</html>
